package com.winter.config;

import com.rabbitmq.client.impl.AMQImpl;
import com.winter.model.User;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author: chris_gang
 * @since: 2018/11/13 17:37
 */
//@Component
public class RabbitConfig {
    @Bean("directExchange")
    public DirectExchange getDirectExchange(){
        return new DirectExchange("DIRECT_EXCHANGE");
    }

    @Bean("firstQueue")
    public Queue getFirstQueue(){
        return new Queue("FIRST_QUEUE");
    }

    @Bean
    public Binding bindFirst(@Qualifier("firstQueue") Queue queue,
                             @Qualifier("directExchange") DirectExchange directExchange){
        return BindingBuilder.bind(queue).to(directExchange).with("ceshi.best");
    }
    @Bean
    public User getUser(){
        return  new User();
    }
}
